﻿
#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "LevelExit.generated.h"

UCLASS()
class PLATFORMJUMP_API ALevelExit : public AActor
{
	GENERATED_BODY()

	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess=true))
	class UBoxComponent* BoxComponent;

	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess=true))
	class UPaperFlipbookComponent* FlipbookComponent;

	UPROPERTY(EditAnywhere, meta=(AllowPrivateAccess=true))
	USoundBase* PlayerEnterSound;

	UPROPERTY(EditAnywhere, meta=(AllowPrivateAccess=true))
	int LevelIndex = 1;

	UPROPERTY(EditAnywhere, meta=(AllowPrivateAccess=true))
	float WaitTimeInSeconds = 2.0f;
	
	bool IsActive = true;
	
	FTimerHandle WaitTimer;

public:
	ALevelExit();
	virtual void BeginPlay() override;
	virtual void Tick(float DeltaTime) override;

	UFUNCTION()
	void OverlapBegin(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);

	void OnWaitTimerTimeout();
};
